(0) Obligation:

The Runtime Complexity (innermost) of the given CpxTRS could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

min(X, 0) → X
min(s(X), s(Y)) → min(X, Y)
quot(0, s(Y)) → 0
quot(s(X), s(Y)) → s(quot(min(X, Y), s(Y)))
log(s(0)) → 0
log(s(s(X))) → s(log(s(quot(X, s(s(0))))))

Rewrite Strategy: INNERMOST

(1) TrsToWeightedTrsProof (BOTH BOUNDS(ID, ID) transformation)

Transformed TRS to weighted TRS

(2) Obligation:

The Runtime Complexity (innermost) of the given CpxWeightedTrs could be proven to be BOUNDS(1, n^1).


The TRS R consists of the following rules:

min(X, 0) → X [1]
min(s(X), s(Y)) → min(X, Y) [1]
quot(0, s(Y)) → 0 [1]
quot(s(X), s(Y)) → s(quot(min(X, Y), s(Y))) [1]
log(s(0)) → 0 [1]
log(s(s(X))) → s(log(s(quot(X, s(s(0)))))) [1]

Rewrite Strategy: INNERMOST

(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)

Infered types.

(4) Obligation:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

min(X, 0) → X [1]
min(s(X), s(Y)) → min(X, Y) [1]
quot(0, s(Y)) → 0 [1]
quot(s(X), s(Y)) → s(quot(min(X, Y), s(Y))) [1]
log(s(0)) → 0 [1]
log(s(s(X))) → s(log(s(quot(X, s(s(0)))))) [1]

The TRS has the following type information:
min :: 0:s → 0:s → 0:s
0 :: 0:s
s :: 0:s → 0:s
quot :: 0:s → 0:s → 0:s
log :: 0:s → 0:s

Rewrite Strategy: INNERMOST

(5) CompletionProof (UPPER BOUND(ID) transformation)

The TRS is a completely defined constructor system, as every type has a constant constructor and the following rules were added:

min(v0, v1) → null_min [0]
quot(v0, v1) → null_quot [0]
log(v0) → null_log [0]

And the following fresh constants:

null_min, null_quot, null_log

(6) Obligation:

Runtime Complexity Weighted TRS where all functions are completely defined. The underlying TRS is:

Runtime Complexity Weighted TRS with Types.
The TRS R consists of the following rules:

min(X, 0) → X [1]
min(s(X), s(Y)) → min(X, Y) [1]
quot(0, s(Y)) → 0 [1]
quot(s(X), s(Y)) → s(quot(min(X, Y), s(Y))) [1]
log(s(0)) → 0 [1]
log(s(s(X))) → s(log(s(quot(X, s(s(0)))))) [1]
min(v0, v1) → null_min [0]
quot(v0, v1) → null_quot [0]
log(v0) → null_log [0]

The TRS has the following type information:
min :: 0:s:null_min:null_quot:null_log → 0:s:null_min:null_quot:null_log → 0:s:null_min:null_quot:null_log
0 :: 0:s:null_min:null_quot:null_log
s :: 0:s:null_min:null_quot:null_log → 0:s:null_min:null_quot:null_log
quot :: 0:s:null_min:null_quot:null_log → 0:s:null_min:null_quot:null_log → 0:s:null_min:null_quot:null_log
log :: 0:s:null_min:null_quot:null_log → 0:s:null_min:null_quot:null_log
null_min :: 0:s:null_min:null_quot:null_log
null_quot :: 0:s:null_min:null_quot:null_log
null_log :: 0:s:null_min:null_quot:null_log

Rewrite Strategy: INNERMOST

(7) CpxTypedWeightedTrsToRntsProof (UPPER BOUND(ID) transformation)

Transformed the TRS into an over-approximating RNTS by (improved) Size Abstraction.
The constant constructors are abstracted as follows:

0 => 0
null_min => 0
null_quot => 0
null_log => 0

(8) Obligation:

Complexity RNTS consisting of the following rules:

log(z) -{ 1 }→ 0 :|: z = 1 + 0
log(z) -{ 0 }→ 0 :|: v0 >= 0, z = v0
log(z) -{ 1 }→ 1 + log(1 + quot(X, 1 + (1 + 0))) :|: z = 1 + (1 + X), X >= 0
min(z, z') -{ 1 }→ X :|: X >= 0, z = X, z' = 0
min(z, z') -{ 1 }→ min(X, Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0
min(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
quot(z, z') -{ 1 }→ 0 :|: Y >= 0, z' = 1 + Y, z = 0
quot(z, z') -{ 0 }→ 0 :|: v0 >= 0, v1 >= 0, z = v0, z' = v1
quot(z, z') -{ 1 }→ 1 + quot(min(X, Y), 1 + Y) :|: z = 1 + X, Y >= 0, z' = 1 + Y, X >= 0

Only complete derivations are relevant for the runtime complexity.

(9) CompleteCoflocoProof (EQUIVALENT transformation)

Transformed the RNTS (where only complete derivations are relevant) into cost relations for CoFloCo:

eq(start(V, V1),0,[min(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[quot(V, V1, Out)],[V >= 0,V1 >= 0]).
eq(start(V, V1),0,[log(V, Out)],[V >= 0]).
eq(min(V, V1, Out),1,[],[Out = X1,X1 >= 0,V = X1,V1 = 0]).
eq(min(V, V1, Out),1,[min(X2, Y1, Ret)],[Out = Ret,V = 1 + X2,Y1 >= 0,V1 = 1 + Y1,X2 >= 0]).
eq(quot(V, V1, Out),1,[],[Out = 0,Y2 >= 0,V1 = 1 + Y2,V = 0]).
eq(quot(V, V1, Out),1,[min(X3, Y3, Ret10),quot(Ret10, 1 + Y3, Ret1)],[Out = 1 + Ret1,V = 1 + X3,Y3 >= 0,V1 = 1 + Y3,X3 >= 0]).
eq(log(V, Out),1,[],[Out = 0,V = 1]).
eq(log(V, Out),1,[quot(X4, 1 + (1 + 0), Ret101),log(1 + Ret101, Ret11)],[Out = 1 + Ret11,V = 2 + X4,X4 >= 0]).
eq(min(V, V1, Out),0,[],[Out = 0,V2 >= 0,V3 >= 0,V = V2,V1 = V3]).
eq(quot(V, V1, Out),0,[],[Out = 0,V4 >= 0,V5 >= 0,V = V4,V1 = V5]).
eq(log(V, Out),0,[],[Out = 0,V6 >= 0,V = V6]).
input_output_vars(min(V,V1,Out),[V,V1],[Out]).
input_output_vars(quot(V,V1,Out),[V,V1],[Out]).
input_output_vars(log(V,Out),[V],[Out]).

CoFloCo proof output:
Preprocessing Cost Relations
=====================================

#### Computed strongly connected components
0. recursive : [min/3]
1. recursive : [quot/3]
2. recursive : [log/2]
3. non_recursive : [start/2]

#### Obtained direct recursion through partial evaluation
0. SCC is partially evaluated into min/3
1. SCC is partially evaluated into quot/3
2. SCC is partially evaluated into log/2
3. SCC is partially evaluated into start/2

Control-Flow Refinement of Cost Relations
=====================================

### Specialization of cost equations min/3
* CE 7 is refined into CE [14]
* CE 5 is refined into CE [15]
* CE 6 is refined into CE [16]


### Cost equations --> "Loop" of min/3
* CEs [16] --> Loop 9
* CEs [14] --> Loop 10
* CEs [15] --> Loop 11

### Ranking functions of CR min(V,V1,Out)
* RF of phase [9]: [V,V1]

#### Partial ranking functions of CR min(V,V1,Out)
* Partial RF of phase [9]:
- RF of loop [9:1]:
V
V1


### Specialization of cost equations quot/3
* CE 8 is refined into CE [17]
* CE 10 is refined into CE [18]
* CE 9 is refined into CE [19,20,21]


### Cost equations --> "Loop" of quot/3
* CEs [21] --> Loop 12
* CEs [20] --> Loop 13
* CEs [19] --> Loop 14
* CEs [17,18] --> Loop 15

### Ranking functions of CR quot(V,V1,Out)
* RF of phase [12]: [V-1,V-V1+1]
* RF of phase [14]: [V]

#### Partial ranking functions of CR quot(V,V1,Out)
* Partial RF of phase [12]:
- RF of loop [12:1]:
V-1
V-V1+1
* Partial RF of phase [14]:
- RF of loop [14:1]:
V


### Specialization of cost equations log/2
* CE 11 is refined into CE [22]
* CE 13 is refined into CE [23]
* CE 12 is refined into CE [24,25,26,27]


### Cost equations --> "Loop" of log/2
* CEs [27] --> Loop 16
* CEs [26] --> Loop 17
* CEs [25] --> Loop 18
* CEs [24] --> Loop 19
* CEs [22,23] --> Loop 20

### Ranking functions of CR log(V,Out)
* RF of phase [16,17]: [V-3,V/2-3/2]

#### Partial ranking functions of CR log(V,Out)
* Partial RF of phase [16,17]:
- RF of loop [16:1]:
V/2-2
- RF of loop [17:1]:
V-3


### Specialization of cost equations start/2
* CE 2 is refined into CE [28,29,30]
* CE 3 is refined into CE [31,32,33,34,35]
* CE 4 is refined into CE [36,37,38,39,40,41]


### Cost equations --> "Loop" of start/2
* CEs [31] --> Loop 21
* CEs [28,29,30,32,33,34,35,36,37,38,39,40,41] --> Loop 22

### Ranking functions of CR start(V,V1)

#### Partial ranking functions of CR start(V,V1)


Computing Bounds
=====================================

#### Cost of chains of min(V,V1,Out):
* Chain [[9],11]: 1*it(9)+1
Such that:it(9) =< V1

with precondition: [V=Out+V1,V1>=1,V>=V1]

* Chain [[9],10]: 1*it(9)+0
Such that:it(9) =< V1

with precondition: [Out=0,V>=1,V1>=1]

* Chain [11]: 1
with precondition: [V1=0,V=Out,V>=0]

* Chain [10]: 0
with precondition: [Out=0,V>=0,V1>=0]


#### Cost of chains of quot(V,V1,Out):
* Chain [[14],15]: 2*it(14)+1
Such that:it(14) =< Out

with precondition: [V1=1,Out>=1,V>=Out]

* Chain [[14],13,15]: 2*it(14)+1*s(2)+2
Such that:s(2) =< 1
it(14) =< Out

with precondition: [V1=1,Out>=2,V>=Out]

* Chain [[12],15]: 2*it(12)+1*s(5)+1
Such that:it(12) =< V-V1+1
aux(3) =< V
it(12) =< aux(3)
s(5) =< aux(3)

with precondition: [V1>=2,Out>=1,V+2>=2*Out+V1]

* Chain [[12],13,15]: 2*it(12)+1*s(2)+1*s(5)+2
Such that:it(12) =< V-V1+1
s(2) =< V1
aux(4) =< V
it(12) =< aux(4)
s(5) =< aux(4)

with precondition: [V1>=2,Out>=2,V+3>=2*Out+V1]

* Chain [15]: 1
with precondition: [Out=0,V>=0,V1>=0]

* Chain [13,15]: 1*s(2)+2
Such that:s(2) =< V1

with precondition: [Out=1,V>=1,V1>=1]


#### Cost of chains of log(V,Out):
* Chain [[16,17],20]: 3*it(16)+2*it(17)+3*s(21)+1*s(22)+3*s(24)+1
Such that:s(25) =< 2*V
aux(14) =< 5/2*V
aux(13) =< 5/2*V+27/2
aux(15) =< V
aux(16) =< V/2
aux(8) =< aux(15)
it(16) =< aux(15)
it(17) =< aux(15)
aux(8) =< aux(16)
it(16) =< aux(16)
it(17) =< aux(16)
it(17) =< aux(13)
s(23) =< aux(13)
it(17) =< aux(14)
s(23) =< aux(14)
s(22) =< aux(8)*2
s(24) =< s(25)
s(21) =< s(23)

with precondition: [Out>=1,V>=3*Out+1]

* Chain [[16,17],19,20]: 3*it(16)+2*it(17)+3*s(21)+1*s(22)+3*s(24)+3
Such that:s(25) =< 2*V
aux(14) =< 5/2*V
aux(13) =< 5/2*V+27/2
aux(17) =< V
aux(18) =< V/2
aux(8) =< aux(17)
it(16) =< aux(17)
it(17) =< aux(17)
aux(8) =< aux(18)
it(16) =< aux(18)
it(17) =< aux(18)
it(17) =< aux(13)
s(23) =< aux(13)
it(17) =< aux(14)
s(23) =< aux(14)
s(22) =< aux(8)*2
s(24) =< s(25)
s(21) =< s(23)

with precondition: [Out>=2,V+2>=3*Out]

* Chain [[16,17],18,20]: 3*it(16)+2*it(17)+3*s(21)+1*s(22)+3*s(24)+1*s(26)+4
Such that:s(26) =< 2
s(25) =< 2*V
aux(14) =< 5/2*V
aux(13) =< 5/2*V+27/2
aux(19) =< V
aux(20) =< V/2
aux(8) =< aux(19)
it(16) =< aux(19)
it(17) =< aux(19)
aux(8) =< aux(20)
it(16) =< aux(20)
it(17) =< aux(20)
it(17) =< aux(13)
s(23) =< aux(13)
it(17) =< aux(14)
s(23) =< aux(14)
s(22) =< aux(8)*2
s(24) =< s(25)
s(21) =< s(23)

with precondition: [Out>=2,V+3>=4*Out]

* Chain [[16,17],18,19,20]: 3*it(16)+2*it(17)+3*s(21)+1*s(22)+3*s(24)+1*s(26)+6
Such that:s(26) =< 2
s(25) =< 2*V
aux(14) =< 5/2*V
aux(13) =< 5/2*V+27/2
aux(21) =< V
aux(22) =< V/2
aux(8) =< aux(21)
it(16) =< aux(21)
it(17) =< aux(21)
aux(8) =< aux(22)
it(16) =< aux(22)
it(17) =< aux(22)
it(17) =< aux(13)
s(23) =< aux(13)
it(17) =< aux(14)
s(23) =< aux(14)
s(22) =< aux(8)*2
s(24) =< s(25)
s(21) =< s(23)

with precondition: [Out>=3,V+7>=4*Out]

* Chain [20]: 1
with precondition: [Out=0,V>=0]

* Chain [19,20]: 3
with precondition: [Out=1,V>=2]

* Chain [18,20]: 1*s(26)+4
Such that:s(26) =< 2

with precondition: [Out=1,V>=3]

* Chain [18,19,20]: 1*s(26)+6
Such that:s(26) =< 2

with precondition: [Out=2,V>=3]


#### Cost of chains of start(V,V1):
* Chain [22]: 4*s(53)+4*s(56)+2*s(58)+3*s(63)+12*s(70)+8*s(71)+4*s(73)+12*s(74)+12*s(75)+6
Such that:aux(28) =< 2
aux(29) =< V
aux(30) =< V-V1+1
aux(31) =< 2*V
aux(32) =< V/2
aux(33) =< 5/2*V
aux(34) =< 5/2*V+27/2
aux(35) =< V1
s(63) =< aux(28)
s(56) =< aux(30)
s(53) =< aux(35)
s(69) =< aux(29)
s(70) =< aux(29)
s(71) =< aux(29)
s(69) =< aux(32)
s(70) =< aux(32)
s(71) =< aux(32)
s(71) =< aux(34)
s(72) =< aux(34)
s(71) =< aux(33)
s(72) =< aux(33)
s(73) =< s(69)*2
s(74) =< aux(31)
s(75) =< s(72)
s(56) =< aux(29)
s(58) =< aux(29)

with precondition: [V>=0]

* Chain [21]: 1*s(102)+4*s(104)+2
Such that:s(102) =< 1
s(103) =< V
s(104) =< s(103)

with precondition: [V1=1,V>=1]


Closed-form bounds of start(V,V1):
-------------------------------------
* Chain [22] with precondition: [V>=0]
- Upper bound: 30*V+12+nat(V1)*4+24*V+ (30*V+162)+nat(V-V1+1)*4
- Complexity: n
* Chain [21] with precondition: [V1=1,V>=1]
- Upper bound: 4*V+3
- Complexity: n

### Maximum cost of start(V,V1): 26*V+9+nat(V1)*4+24*V+ (30*V+162)+nat(V-V1+1)*4+ (4*V+3)
Asymptotic class: n
* Total analysis performed in 375 ms.

(10) BOUNDS(1, n^1)